package chixing.day10.work;

public class RollBack {
    // 给定一个字符串，返回其反转后的新字符串。例如，输入 "hello"，输出 "olleh"
    public static String rollBack(String str) {
        char[] chars = str.toCharArray();
        char[] newChars = new char[chars.length];
        for (int i = chars.length - 1; i >=0; i--) {
            newChars[chars.length - 1 - i] = chars[i];
        }
        return new String(newChars);
    }
    public static void main(String[] args) {
        String str = "hello";
        System.out.println(rollBack(str));
    }
}
